<?php

namespace App\Policies\Orders;

use App\Models\Orders\Repositories\Interfaces\OrdersInterface;
use App\Models\Task\SnapTasks\SnapTask;
use App\Models\User\User;
use Illuminate\Auth\Access\HandlesAuthorization;

class OrderPolicy
{
    use HandlesAuthorization;

    /**
     * Create a new policy instance.
     *
     * @return void
     */
    public function __construct()
    {

    }

    /**
     * 订单访问权限
     *
     */
    public function access(User $user, OrdersInterface $order): bool
    {
        return $user->getUserId() === $order->getUserId();
    }

    public function access_task(User $user, SnapTask $task): bool
    {
        return $user->getUserId() === $task->getUserId();
    }
}
